import java.util.Arrays;
import java.util.Random;

public class Test {

    public static void initArrayOrder(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] = i;
        }
    }

    public static void initArrayNotOrder(int[] array){
        Random random = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = random.nextInt(10_0000);
        }
    }
    public static void testInsertSort(int[] array){
        array = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort.insertSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("直接插入排序耗时："+(endTime-startTime));
    }

    public static void testShellSort(int[] array){
        array = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort.insertSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("希尔排序耗时："+(endTime-startTime));
    }
    public static void main2(String[] args) {
        int[] array = new int[10_0000];
        //initArrayOrder(array);
        initArrayNotOrder(array);
        testInsertSort(array);
        testShellSort(array);


    }
    public static void main(String[] args) {
        int[] array = {99,51,23,66,77,89,33,65};
        Sort.mergeSort2(array);
        System.out.println(Arrays.toString(array));
    }
}
